Language Overview Simple functions in yassl
This example creates yet another button, and attaches a procedure to it. This is the yassl script that does this task.
proc void pushed()
{
ButtonLabel(b, 'Owww..');
Enable(b, false);
}
Button b = new Button;
ButtonLabel(b, 'Press me');
SetAction(b, pushed);
Add(thisApplet, b);
Procedures are created with the proc
keyword. SetAction is a general function that takes a widget
and attaches a method to it. The method is called when any action
occurs in the widget. The function Add is another general
function that adds a widget to a container. The special variable
thisApplet is available when the interpreter is invoked
as an Applet. It is the applet itself, which permits new widgets
to be added into the applet. Labels of buttons are set with
ButtonLabel, which takes a Button and a String
as arguments. Finally, any widget can be enabled or disabled with the
general purpose Enable procedure.
KB Sriram
Comments, bug reports: kbs@sbktech.org
Revised: Sat May 25 02:58:13 1996
URL: http://www.sbktech.org/yas_butcb.html